home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-07 | 2.9 KB | 115 lines | [TEXT/MPS ] |
- (*
- playVideo first,last - Play the frames from first to last, at a speed given in
- the global videoSpeed, using blanking to the first frame if the global
- blankNextVideo is set to true.
-
- To compile and link this file using Macintosh Programmer's Workshop,
-
- pascal -w playVideo.p
-
- link -m ENTRYPOINT -o HyperCommands -rt XCMD=8002 -sn Main=playVideo ∂
- playVideo.p.o "{MPW}"Libraries:interface.o "{MPW}"PLibraries:PasLib.o
-
- Copyright © 1987,88 Apple Computer, Inc.
-
- 9/87 - Initial coding by Harry R. Chesley.
- 2/88 - Updated to new specification by Harry R. Chesley.
- *)
-
- {$R-}
-
- {$S playVideo } { Segment name must be the same as the command name. }
-
- unit DummyUnit;
-
- interface
-
- uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- implementation
-
- type
-
- Str31 = String[31];
-
- procedure playVideo(paramPtr: XCmdPtr); forward;
-
- procedure EntryPoint(paramPtr: XCmdPtr);
-
- begin
- playVideo(paramPtr);
- end;
-
- procedure playVideo(paramPtr: XCmdPtr);
-
- var numberOfParms: integer; { Number of parameters on the command. }
- firstFrame: str255; { First frame number. }
- lastFrame: str255; { Last frame number. }
- fps: str255; { Frames-per-second. }
- str: str255;
-
- {$I XCmdGlue.inc}
-
- procedure Fail(errMsg: Str255); { set theResult and quit }
- begin
- paramPtr^.returnValue := PasToZero(errMsg);
- exit(playVideo);
- end;
-
- {$I VideoUtil.inc}
-
- begin
- numberOfParms := paramPtr^.paramCount;
- if numberOfParms > 2 then Fail('parameter count is not 0-2');
-
- { Get the first frame number. }
- if numberOfParms > 0 then
- begin
- GetStrParm(1,firstFrame);
- { Weed out special cases, so the drivers don't have to. }
- if firstFrame = '' then firstFrame := 'here'
- else if (not StringEqual(firstFrame,'here')) and (StrToNum(firstFrame) < 0) then firstFrame := '0';
- end
- else firstFrame := 'here';
-
- { Get the last frame number. }
- if numberOfParms > 1 then
- begin
- GetStrParm(2,lastFrame);
- { Weed out special cases. }
- if lastFrame = '' then lastFrame := 'lastFrame'
- else if not StringEqual(lastFrame,'lastFrame') then
- begin
- GetStrGlobal('videoMode',str);
- if StringEqual(str,'chapterMode') then
- begin
- if StrToNum(lastFrame) < 0 then lastFrame := '0';
- end
- else if StrToNum(lastFrame) <= 1 then lastFrame := '0';
- end;
- end
- else lastFrame := 'lastFrame';
- { Remember what we're playing to. }
- if StringEqual(lastFrame,'lastFrame') then SetStrGlobal('lastVideoFrame','54000')
- else SetStrGlobal('lastVideoFrame',lastFrame);
-
- { Make sure the speed is there. }
- GetStrGlobal('videoSpeed',fps);
- if fps = '' then
- begin
- fps := '30';
- SetStrGlobal('videoSpeed',fps);
- end;
-
- { Call the player-specific driver to actually do it. }
- videoCmd('play',Concat(firstFrame,',',lastFrame));
-
- { Clear out the speed and blanking globals. }
- SetStrGlobal('videoSpeed','');
- SetStrGlobal('blankNextVideo','');
- end;
-
- end.
-